package com.findweb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.findweb.guava.TradeAccount;
import com.findweb.guava.service.ITradeAccountService;

@RestController
public class CacheTestController {
	
	@Autowired
	private ITradeAccountService tradeService;
	
	@RequestMapping("/cache")
	public TradeAccount greeting(
			@RequestParam(value = "count", defaultValue = "1") int count){
		
		if(count == 1){
			return tradeService.getTradeAccountById("key1", "zzm", 0.0);
		}else if(count ==2){
			return tradeService.getTradeAccountById("key1", "water", 3.0);
		}
		else{
			return tradeService.getTradeAccountById("key2", "zzm", 1.0);
		}
		
	}

}
